// Object/Functions
interface Point {
    x: number,
    y: number
}
interface SetPoint {
    (x: number, y: number): void
}
type PointType = {
    x: number;
    y: number;
}
type SetPointType = (x: number, y:number) => void

// Other Types
// 与接口不同，类型别名还可以用于其他类型，如基本类型（原始值）、联合类型、元组
// object
type PartialPointX = { x: number; };
type PartialPointY = { y: number; };
// union
type PartialPoint = PartialPointX | PartialPointY;
// tuple
type Data = [number, string];

// 接口可以定义多次，类型别名不可以
interface Class {
    name: string
}
interface Class {
    no: number
}

// 扩展
// 扩展-接口扩展接口
interface PointX {
    x: number
}
interface MyPoint extends PointX {
    y: number
}
// 类型别名扩展类型别名
type PointY = {
    X: number
}
type MyPointY = PointX & {
    y: number
}
// 接口扩展类型别名
type PointZ = {
    x: number
}
interface MyPointZ extends PointZ {
    y: number
}
// 类型别名扩展接口
interface PointD {
    x: number
}
type MyPointD = PointD & {
    y: number
}